<?php
require_once 'DBConnecter.inc';
class Evaluation_check extends DBConnecter {
	public $timecheck = "";
	public $ratevalue1 = "";
	public $ratevalue2 = "";
	public $printout = "";
	
	function __construct() {
		$this->connectDB ();
		// $this->selectDB ( 'devdog' );
	}
	public function time_check($table,$mem_id,$time){
		$sql = "CALL " . self::CONST_DB . ".eval_check('".$table."','" . $mem_id . "','" . $time . "');select @out_err_cd, @out_err_msg;";
		//echo $sql;
		if ($rs = $this->getMySqlConneter ()->multi_query ( $sql )) {
			if ($rs != null && $rs = $this->getMySqlConneter ()->use_result ()) {
				$row = $rs->fetch_row ();
				if (! empty ( $row )) {
					$reVal = $row ['0'];;
					$this->timecheck = $reVal;
					return $reVal;
				}
				$rs->free ();
			}
		}
		
	}
	public function rate_search($table,$time,$ratecode,$ratevalue){
		$sql = "CALL " . self::CONST_DB . ".eval_rate_data('".$table."','".$time."','" . $ratecode . "','" . $ratevalue . "');select @out_err_cd, @out_err_msg;";
		//echo $sql;
		if ($rs = $this->getMySqlConneter ()->multi_query ( $sql )) {
			if ($rs != null && $rs = $this->getMySqlConneter ()->use_result ()) {
				while ( $row = $rs->fetch_row () ) {
					if($row['0'] == '401'){
						$this->ratevalue1 = $row ['1'];
					}else if($row['0'] == '402'){
						$this->ratevalue2 = $row ['1'];
					}
				}
				$rs->free ();
			}
		}
	}
	public function date_search($table,$mem_id,$time){
		$sql = "CALL " . self::CONST_DB . ".eval_check('".$table."','" . $mem_id . "','" . $time . "');select @out_err_cd, @out_err_msg;";
		if ($rs = $this->getMySqlConneter ()->multi_query ( $sql )) {
			if ($rs != null && $rs = $this->getMySqlConneter ()->use_result ()) {
				while ( $row = $rs->fetch_row () ) {
					
					echo "<option value='".$row['0']."'>";
					echo $row['0'];
					echo "</option>";
				}
				$rs->free ();
			}
		}
	}
}